<template>
	<view class="gongdi">
		<view class="gongdi-item" v-for="(item, index) of videoList" :key="index">
			<video :src="item.url" class="sel-video" @error="handleVideoErr" is-live></video>
			<view class="gongdi-item-con">{{item.intro}}</view>
		</view>
	</view>
</template>

<script>
	// 安卓环境测试
	export default {
		name: 'gongdi',
		data() {
			return {
				videoList: [
					{
						url: 'http://pullvideo.dtsdwh.cn/live/test2.m3u8?txSecret=a998d24fb502098f78b2b7f9c3d84f5d&txTime=65E02BC9',
						name: '腾讯云直播',
						intro: '视频说明：腾讯云直播测试m3u8'
					},
					{
						url: 'rtmp://pullvideo.dtsdwh.cn/live/test2?txSecret=a998d24fb502098f78b2b7f9c3d84f5d&txTime=65E02BC9',
						name: '项目名称',
						intro: '视频说明：腾讯云直播测试rtmp'
					},
					{
						url: 'https://sd7.taopianplay1.com:43333/c56b1bc09da3/HD/2024-01-10/1/cd1061af99c7/066e180022b3/playlist.m3u8',
						name: 'm3u8 ',
						intro: '视频说明：一楼大堂监控'
					},
					{
						url: 'webrtc://pullvideo.dtsdwh.cn/live/test2?txSecret=a998d24fb502098f78b2b7f9c3d84f5d&txTime=65E02BC9',
						name: '项目名称',
						intro: '视频说明：一楼大堂监控'
					},
					{
						url: 'http://pullvideo.dtsdwh.cn/live/test2.flv?txSecret=a998d24fb502098f78b2b7f9c3d84f5d&txTime=65E02BC9',
						name: '项目名称',
						intro: '视频说明：一楼大堂监控'
					}
				]
			}
		},
		mounted() {
					// let pages = getCurrentPages()
					// let page = pages[pages.length-1]
					// let currentWebview = page.$getAppWebview()
					
					// let player = new plus.video.VideoPlayer('video-player', {
					// 	src: 'rtmp://pullvideo.dtsdwh.cn/live/test2.flv?txSecret=0f0e053953d4607707707f253517d2ef&txTime=65E00B1A',
					// 	top: '0px',
					// 	left: '0px',
					// 	width:'100%',
					// 	height: '200px',
					// 	position:'static'
					// })
					
					// currentWebview.append(player)
					
					// player.play()
				},
		methods: {
			handleVideoErr(res) {
				console.log('err')
			}
		}
	}
</script>

<style>
	.gongdi {
		width: 96%;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		margin: 10upx auto;
	}

	.gongdi-item {
		width: 45%;
		height: 320upx;
		border: 1px solid #1ABC9C;
		margin-top: 10upx;
	}

	.gongdi-item-con {
		width: 100%;
		height: 60upx;
		line-height: 60upx;
		font-size: 28upx;
		text-align: center;
		overflow: auto;
		white-space: nowrap;
	}

	.sel-video {
		width: 100%;
		height: 260upx;
	}
</style>